<?php

namespace App\Listeners\GoldenEggs;

use App\Events\GoldenEggsCreated;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Morefun\GoldenEggs\RedisSynchronizer as GoldenEggsRedisSynchronizer;

class WriteGoldenEggsToRedis
{
    protected $synchronizer;

    /**
     * @param GoldenEggsRedisSynchronizer $synchronizer
     * Create the event listener.
     */
    public function __construct(GoldenEggsRedisSynchronizer $synchronizer)
    {
        $this->synchronizer = $synchronizer;
    }

    /**
     * Handle the event.
     *
     * @param  GoldenEggsCreated  $event
     * @return void
     */
    public function handle(GoldenEggsCreated $event)
    {
        $this->synchronizer->write($event->activity);
    }
}
